package com.dhu719.label_end.controller;

import com.dhu719.label_end.domain.Label;
import com.dhu719.label_end.service.LabelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>Title: $file.className</p>
 * <p>Description: </p>
 *
 * @author Kaboon
 * @date
 */
@RestController
@RequestMapping(value = "/label", produces = {"application/json;charset=UTF-8"})
public class LabelController {
    @Autowired
    LabelService labelService;

    @RequestMapping(value = "/selectByImage", method = RequestMethod.GET)
    public Label selectByImage(@RequestParam(value = "image_id") String image_id,
                                     @RequestParam(value = "username") String username) {
        return labelService.selectByImageId(image_id,username);
    }

    @RequestMapping(value = "/addLabel", method = RequestMethod.POST)
    public String addLabel(@RequestBody Label label) {
        return labelService.addLabel(label);
    }

    @RequestMapping(value = "update", method = RequestMethod.PUT)
    public String updateLabel(@RequestBody Label label){
        return labelService.update(label);
    }
}
